package org.vgou.model;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * 
 * Copyright (c) 2011, vgou All rights reserved.
 * 
 * @since Nov 27, 2011
 * @author <a href="mailto:jason.hxx@gmail.com">jason</a>
 * @version Id: ProductContent.java Nov 27, 2011
 * @comment 产品内容介绍实体类
 * 
 */
@Entity
// 更新一个对象时,会生成动态SQL,当属性值发生变化时，才会包含到UPDATE语句中
@org.hibernate.annotations.Entity(dynamicUpdate = true, dynamicInsert = true)
@Table(name = "productcontent")
public class ProductContent implements Serializable {

	private static final long serialVersionUID = -349737230002901396L;

	/** 编号 **/
	@Id
	@GeneratedValue
	@Column(name="id", length=19)
	private long id;
	
	/** 短语简介  **/
	@Column(name="summary")
	private String summary;
	

	/** 简介快照  **/
	@Lob
	@Column(name="snapshot")
	private byte[] snapshot;
	
	
	/** 所属产品 **/
	@ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.ALL)
	@JoinColumn(name="productid")
	private Product product;

	public ProductContent() {
		super();
	}

	public ProductContent(long id, String summary, byte[] snapshot,
			Product product) {
		super();
		this.id = id;
		this.summary = summary;
		this.snapshot = snapshot;
		this.product = product;
	}

	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getSummary() {
		return summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	public byte[] getSnapshot() {
		return snapshot;
	}

	public void setSnapshot(byte[] snapshot) {
		this.snapshot = snapshot;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

}
